package business.bl;

import java.util.HashMap;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import business.facade.CandidatoFacade;
import business.facade.GestioneCandidatoFacade;

import util.ServerResponse;

public class GestioneCandidatoBL implements BasicOperation {
	
	public static Logger logger = LogManager.getLogger(GestioneCandidatoBL.class);
	
	@Override
	public ServerResponse save(HashMap parametersList) throws Exception {
		String servletName = (String) parametersList.get("servletName");
		
		String serverResponseMessage="OK";
        ServerResponse serverResponse = new ServerResponse(servletName, null, serverResponseMessage);
        
        
        try {
        	 GestioneCandidatoFacade gcf=new GestioneCandidatoFacade();
    		  serverResponse=gcf.save(parametersList);

  		} catch (Throwable ex) {
  		    // Log the exception.
  		    logger.error("Initial SessionFactory creation failed.", ex); throw new ExceptionInInitializerError(ex);
  		}
        
        
        return serverResponse;
	}

	@Override
	public ServerResponse list(HashMap parametersList) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ServerResponse delete(HashMap parametersList) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ServerResponse load(HashMap parametersList) throws Exception {
		String servletName = (String) parametersList.get("servletName");
		
		String serverResponseMessage="OK";
        ServerResponse serverResponse = new ServerResponse(servletName, null, serverResponseMessage);
        
        
        try {
  		   GestioneCandidatoFacade gcf=new GestioneCandidatoFacade();
  		   serverResponse=gcf.load(parametersList);

  		} catch (Throwable ex) {
  		    // Log the exception.
  		    logger.error("Initial SessionFactory creation failed.", ex);
  		}
        
        
        return serverResponse;
	}

	@Override
	public ServerResponse upload(HashMap parametersList) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ServerResponse create(HashMap parametersList) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

}
